package com.example.template.ui.home.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.MultiTransformation;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.common.config.AppConfig;
import com.example.template.R;
import com.example.template.http.entity.CommunityEntity;
import com.example.template.http.entity.TradeEntity;

import org.jetbrains.annotations.NotNull;

public class HomeTradeAdapter extends BaseQuickAdapter<TradeEntity, BaseViewHolder> {


    public HomeTradeAdapter() {
        super(R.layout.adapter_home_trade_item);
    }


    @Override
    protected void convert(@NotNull BaseViewHolder helper, @NotNull TradeEntity item) {
        helper.setText(R.id.tv_name,item.getTeamName());
        helper.setText(R.id.tv_price,item.getTotalProfit() + "%");
        ImageView imageView = helper.findView(R.id.image_avatar);
        Glide.with(imageView).load(AppConfig.getInstance().getConfig().OSS_URL() + "/" + item.getAvatar()).placeholder(com.example.common.R.drawable.avatar).transform(new MultiTransformation<>(new CenterCrop(), new CircleCrop())).into(imageView);
    }

}
